#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableDemoEnemySailorAIDao:DaoBase<TableDemoEnemySailorAI>
    {
        public override string GetFileName()
        {
            return "TableDemoEnemySailorAI.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimary = new Dictionary<string, TableDemoEnemySailorAI>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableDemoEnemySailorAI model)
        {
            if (!cacheOneIndex.ContainsKey(model.DemoEnemySailorId.ToString()))
            {
                cacheOneIndex[model.DemoEnemySailorId.ToString()] = new List<TableDemoEnemySailorAI>();
            }
            cacheOneIndex[model.DemoEnemySailorId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableDemoEnemySailorAI model)
        {
            #if UNITY_EDITOR
            if(cachePrimary.ContainsKey(model.id)) UnityEngine.Debug.LogError("数据表id重复:TableDemoEnemySailorAI->id: " + model.id);
            #endif
            cachePrimary[model.id] = model;
        }
        protected override TableDemoEnemySailorAI ParseRowData(string[] rowData)
        {
            TableDemoEnemySailorAI data = new TableDemoEnemySailorAI();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.id = rowData[0];
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.DemoEnemySailorId = rowData[1];
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.SkillId = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.Weight = double.Parse(rowData[3]);
            }
            return data;
        }
    }
}
